
<%= form_with model: @article, local: true do |form| %>

  <% if @article.errors.any? %>
    <div id="error_explanation">
      <h2>
        <%= pluralize(@article.errors.count, "error") %> prohibited
        this article from being saved:
      </h2>
      <ul>
        <% @article.errors.full_messages.each do |msg| %>
          <li><%= msg %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <p>
    <%= form.text_field :title, class: 'form-control', placeholder: '这里是标题' %>
  </p>

  <p>
    <%= form.text_area :text, class: 'form-control', placeholder: '这里写正文。PS:不登录不能发表' %>
  </p>

  <p>
    <% if current_user %>
      <%= form.submit "发布", class: "btn btn-primary" %>
    <% end %>
  </p>

<% end %>